#/*+=========================================================================
#  File:       MAKEFILE
#
#  Summary:    Makefile for building the APPUTIL library.  This library
#              is intended to be statically linked and provides some
#              common utility classes and functions to support the
#              construction of Win32 applications (both .EXEs and .DLLs).
#              This MAKEFILE assumes that sibling directories
#              ..\lib and ..\inc are used by applications that link to
#              APPUTIL.LIB.  See APPUTIL.TXT for more details.
#
#              This Makefile creates a subdirectory (TEMP) for the
#              .OBJ files used during the build process.
#
#              For a comprehensive tutorial code tour of APPUTIL's contents
#              and offerings see the accompanying APPUTIL.TXT file.
#              For more specific technical details see the comments
#              dispersed throughout the APPUTIL source code.
#
#              In general, to set up your system to build and test the
#              Win32 code samples in this OLE Tutorial series, see the
#              global TUTORIAL.TXT file for details.  This MAKEFILE is
#              Microsoft NMAKE compatible and the 'debug' build can be
#              achieved by simply issuing the NMAKE command in a
#              command prompt window.
#
#  Builds:     APPUTIL.LIB
#
#  Origin:     7-27-95: atrent - Created.
#
#--Usage:-------------------------------------------------------------------
#  NMAKE Options
#
#  Use the table below to determine the additional options for NMAKE to
#  generate various application debugging, profiling and performance tuning
#  information.
#
#  Application Information Type         Invoke NMAKE
#  ----------------------------         ------------
#  For No Debugging Info                nmake nodebug=1
#  For Working Set Tuner Info           nmake tune=1
#  For Call Attributed Profiling Info   nmake profile=1
#
#  Note: The three options above are mutually exclusive (you may use only
#        one to compile/link the application).
#
#  Note: creating the environment variables NODEBUG, TUNE, and PROFILE
#        is an alternate method to setting these options via the nmake
#        command line.
#
#  Additional NMAKE Options             Invoke NMAKE
#  ----------------------------         ------------
#  For No ANSI NULL Compliance          nmake no_ansi=1
#    (ANSI NULL is defined as PVOID 0)
#  To compile for Unicode               nmake unicode=1
#    (Default is ANSI)
#  To clean up temporary binaries       nmake clean
#  To clean up all generated files      nmake cleanall
#
#--------------------------------------------------------------------------
#  This file is part of the Microsoft OLE Tutorial Code Samples.
#
#  Copyright (C) Microsoft Corporation, 1996.  All rights reserved.
#
#  This source code is intended only as a supplement to Microsoft
#  Development Tools and/or on-line documentation.  See these other
#  materials for detailed information regarding Microsoft code samples.
#
#  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
#  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
#  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
#  PARTICULAR PURPOSE.
#=========================================================================+*/

#  WIN32.MAK should be included at the front of every Win32 makefile.
#
#  Define APPVER = [ 3.50 | 3.51 | 4.0 ] prior to including win32.mak to get
#  build time checking for version dependencies and to mark the executable
#  with version information.
#
#  Define TARGETOS = [ WIN95 | WINNT | BOTH ] prior to including win32.mak
#  to get some build time checking for platform dependencies.
#
APPVER=4.0
TARGETOS=BOTH
!include <win32.mak>

# Assign the main program name macro.
PGM=apputil

# Use a temporary sub-directory to store intermediate.
#   binary files like *.obj, *.res, *.map, etc.
TDIR = TEMP

# Assign destination and consumer sibling directories.
IDIR = ..\inc
LDIR = ..\lib

# If UNICODE=1 is defined then define UNICODE during Compiles.
# The default is to compile with ANSI for running under both
# Win95 and WinNT.
!IFDEF UNICODE
CDBG=$(cdebug) -DUNICODE -D_UNICODE
RCFLAGS = -DWIN32 -DRC_INCLUDE -DUNICODE
!ELSE
CDBG=$(cdebug)
RCFLAGS = -DWIN32 -DRC_INCLUDE
!ENDIF

# If NODEBUG is not defined then define DEBUG during Compiles.
# The default is to compile with debug symbols in the binaries.
!IFNDEF NODEBUG
CDBG = $(CDBG) -DDEBUG
RCFLAGS = $(RCFLAGS) -DDEBUG
!ENDIF

# OBJS is a macro that defines all the object files for the LIB.
OBJS = $(TDIR)\$(PGM).obj

# The final target.
all: tempdir output

# Make the temporary work sub-directory.
tempdir:
  -mkdir $(TDIR)

# The actual output product.
output: $(PGM).lib

# Compilation/Dependency rules for the main source files.
$(TDIR)\$(PGM).obj: $(PGM).cpp $(PGM).h
  $(cc) $(cvars) $(cflags) $(CDBG) -Fo$@ $(PGM).cpp

# Collect and combine the object files into one static library.
$(PGM).lib: $(OBJS)
  lib -out:$(PGM).lib $(OBJS)
  -mkdir $(LDIR)
  copy $(PGM).lib $(LDIR)
  -mkdir $(IDIR)
  copy $(PGM).h $(IDIR)

# Target to clean up temporary binaries.
clean:
  -del *.lib
  -del *.exp
  -deltree /y $(TDIR)
  -rmdir /s /q $(TDIR)

# Target to clean up all generated files.
cleanall:
  -del *.exe
  -del *.dll
  -del *.lib
  -del *.exp
  -del *.obj
  -del *.res
  -del *.map
  -del *.pdb
  -del *.vcp
  -del *.aps
  -del *.pch
  -del *.sbr
  -del *.bsc
  -del *.mdp
  -del *.ncb
  -del *.mak
  -del makefile.exe
  -del resource.h
  -deltree /y windebug
  -rmdir /s /q windebug
  -deltree /y $(TDIR)
  -rmdir /s /q $(TDIR)
